<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Vector Template Library (Vtl): W:/Products/Vtl/branches/v1.0/Vtl/Vtl/include/Vtl/AABBox.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Vector Template Library (Vtl)
   &#160;<span id="projectnumber">v1.0</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_a_a_b_box_8h.html','');
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">W:/Products/Vtl/branches/v1.0/Vtl/Vtl/include/Vtl/AABBox.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_a_a_b_box_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#pragma once</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="comment">/* </span>
<a name="l00003"></a>00003 <span class="comment">* COPYRIGHT 2012 Mafahir Fairoze</span>
<a name="l00004"></a>00004 <span class="comment">* </span>
<a name="l00005"></a>00005 <span class="comment">* This file is part of Vector Template Library (Vtl) v1.0.</span>
<a name="l00006"></a>00006 <span class="comment">* (Project Website : http://mafahir.wordpress.com/projects/neuralplusplus)</span>
<a name="l00007"></a>00007 <span class="comment">* </span>
<a name="l00008"></a>00008 <span class="comment">* Vector Template Library (Vtl) v1.0 is a free software. You can redistribute it and/or modify it under the terms of</span>
<a name="l00009"></a>00009 <span class="comment">* the GNU General Public License as published by the Free Software Foundation, either version 3</span>
<a name="l00010"></a>00010 <span class="comment">* of the License, or (at your option) any later version.</span>
<a name="l00011"></a>00011 <span class="comment">* </span>
<a name="l00012"></a>00012 <span class="comment">* Vector Template Library (Vtl) v1.0 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;</span>
<a name="l00013"></a>00013 <span class="comment">* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span>
<a name="l00014"></a>00014 <span class="comment">* See the GNU General Public License &lt;http://www.gnu.org/licenses/&gt; for more details.</span>
<a name="l00015"></a>00015 <span class="comment">*/</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#include &quot;<a class="code" href="eigen_8h.html">Vtl/eigen.h</a>&quot;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="common_8h.html">Vtl/common.h</a>&quot;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a><a class="code" href="namespace_vtl.html">00020</a> <span class="keyword">namespace </span>Vtl
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022         <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scalar, <span class="keywordtype">int</span> Dimension&gt;
<a name="l00023"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html">00023</a>         <span class="keyword">class </span><a class="code" href="class_vtl_1_1_a_a_b_box.html">AABBox</a>
<a name="l00024"></a>00024         {
<a name="l00025"></a>00025         <span class="keyword">public</span>:
<a name="l00026"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a489359c5f60cb9fd899f1dbb597a95c1">00026</a>                 <span class="keyword">typedef</span> Eigen::Matrix&lt;Scalar, Dimension, 1&gt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a489359c5f60cb9fd899f1dbb597a95c1">VectorType</a>;
<a name="l00027"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">00027</a>                 <span class="keyword">typedef</span> Eigen::Matrix&lt;Scalar, 3, 1&gt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a>;
<a name="l00028"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a44276fff6cf9f37d7cd537dbdba3880b">00028</a>                 <span class="keyword">typedef</span> Eigen::ParametrizedLine&lt;Scalar, Dimension&gt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a44276fff6cf9f37d7cd537dbdba3880b">ParametrizedLine</a>;
<a name="l00029"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a85d1c3d9b76546addd7f711aeb0c024e">00029</a>                 <span class="keyword">typedef</span> Eigen::ParametrizedLine&lt;Scalar, 3&gt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a85d1c3d9b76546addd7f711aeb0c024e">ParametrizedLineX3d</a>;
<a name="l00030"></a>00030 
<a name="l00036"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a8a10bc3599e6c25560bd932557ece10a">00036</a>                 <a class="code" href="class_vtl_1_1_a_a_b_box.html#a8a10bc3599e6c25560bd932557ece10a" title="Default constructor. Sets the bounding box to an empty (uninitialized) state.">AABBox</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> &amp;_Eps = 1e-4)
<a name="l00037"></a>00037                         :<a class="code" href="class_vtl_1_1_a_a_b_box.html#a3ed76b654dddf20fd2b3777afecdffbc">is_empty</a>(true),<a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>(_Eps)
<a name="l00038"></a>00038                 {
<a name="l00039"></a>00039                 }
<a name="l00040"></a>00040 
<a name="l00048"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a0d4a9a581186ef52936bad00069b7ed9">00048</a>                 <a class="code" href="class_vtl_1_1_a_a_b_box.html#a8a10bc3599e6c25560bd932557ece10a" title="Default constructor. Sets the bounding box to an empty (uninitialized) state.">AABBox</a>(<span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a489359c5f60cb9fd899f1dbb597a95c1">VectorType</a> &amp;_Min, <span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a489359c5f60cb9fd899f1dbb597a95c1">VectorType</a> &amp;_Max, <span class="keyword">const</span> <span class="keywordtype">double</span> &amp;_Eps = 1e-4)
<a name="l00049"></a>00049                         :<a class="code" href="class_vtl_1_1_a_a_b_box.html#a3ed76b654dddf20fd2b3777afecdffbc">is_empty</a>(false), <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(common::<a class="code" href="namespace_vtl_1_1common.html#a098b2df81e6cc14cbf9697452e836f93" title="Converts the given vector to 3D using the given K value for [i,j, K].">convertTo3D</a>(_Min)), <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(common::<a class="code" href="namespace_vtl_1_1common.html#a098b2df81e6cc14cbf9697452e836f93" title="Converts the given vector to 3D using the given K value for [i,j, K].">convertTo3D</a>(_Max)), <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>(_Eps)
<a name="l00050"></a>00050                 {
<a name="l00051"></a>00051                 }
<a name="l00052"></a>00052 
<a name="l00057"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a77476077b13c218952a2703735b0b179">00057</a>                 <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a77476077b13c218952a2703735b0b179" title="Returns vector between the maximum and minimum edge.">getExtent</a>()<span class="keyword"> const</span>
<a name="l00058"></a>00058 <span class="keyword">                </span>{
<a name="l00059"></a>00059                         <span class="keywordflow">return</span> (<a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a> - <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>);
<a name="l00060"></a>00060                 }
<a name="l00061"></a>00061 
<a name="l00066"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a2afaaf9e1723b14bf2f2aa8af9840254">00066</a>                 <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a2afaaf9e1723b14bf2f2aa8af9840254" title="Returns the center point of the bounding box.">getCenter</a>()<span class="keyword"> const</span>
<a name="l00067"></a>00067 <span class="keyword">                </span>{
<a name="l00068"></a>00068                         <span class="keywordflow">return</span> (<a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a> + <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>)/2.0;
<a name="l00069"></a>00069                 }
<a name="l00070"></a>00070 
<a name="l00076"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a28b1b7d5995f6e506bd77d829aa8a4f2">00076</a>                 <span class="keywordtype">void</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#ac460935fa714eda53b4f56ccaaf0cfa1" title="Resets the bounding box. Sets the bounding box to empty (uninitialized) state.">Reset</a>(<span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a489359c5f60cb9fd899f1dbb597a95c1">VectorType</a> &amp;_Point)
<a name="l00077"></a>00077                 {
<a name="l00078"></a>00078                         <span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> point = <a class="code" href="namespace_vtl_1_1common.html#a098b2df81e6cc14cbf9697452e836f93" title="Converts the given vector to 3D using the given K value for [i,j, K].">common::convertTo3D</a>(_Point);
<a name="l00079"></a>00079                         <a class="code" href="class_vtl_1_1_a_a_b_box.html#a3ed76b654dddf20fd2b3777afecdffbc">is_empty</a> = <span class="keyword">false</span>;
<a name="l00080"></a>00080                         <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a> = point;
<a name="l00081"></a>00081                         <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a> = point;
<a name="l00082"></a>00082                 }
<a name="l00083"></a>00083 
<a name="l00088"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#ac460935fa714eda53b4f56ccaaf0cfa1">00088</a>                 <span class="keywordtype">void</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#ac460935fa714eda53b4f56ccaaf0cfa1" title="Resets the bounding box. Sets the bounding box to empty (uninitialized) state.">Reset</a>()
<a name="l00089"></a>00089                 {
<a name="l00090"></a>00090                         <a class="code" href="class_vtl_1_1_a_a_b_box.html#a3ed76b654dddf20fd2b3777afecdffbc">is_empty</a> = <span class="keyword">true</span>;
<a name="l00091"></a>00091                         <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a> = <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a> = <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a>();
<a name="l00092"></a>00092                 }
<a name="l00093"></a>00093 
<a name="l00103"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a2d09608f6c2bd28481c114e71c5db402">00103</a>                 <span class="keywordtype">void</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a2d09608f6c2bd28481c114e71c5db402" title="Adds the point to expand bounding box. Only if the given point is outside, the bounding box shall exp...">AddInPoint</a>(<span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a489359c5f60cb9fd899f1dbb597a95c1">VectorType</a> &amp;_Point)
<a name="l00104"></a>00104                 {
<a name="l00105"></a>00105                         <span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> point = <a class="code" href="namespace_vtl_1_1common.html#a098b2df81e6cc14cbf9697452e836f93" title="Converts the given vector to 3D using the given K value for [i,j, K].">common::convertTo3D</a>(_Point);
<a name="l00106"></a>00106                         <span class="keywordflow">if</span>(!<a class="code" href="class_vtl_1_1_a_a_b_box.html#a3ed76b654dddf20fd2b3777afecdffbc">is_empty</a>)
<a name="l00107"></a>00107                         {
<a name="l00108"></a>00108                                 <span class="keywordflow">if</span>(point(0) &gt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(0)) <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(0) = point(0) + <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>;
<a name="l00109"></a>00109                                 <span class="keywordflow">if</span>(point(0) &lt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(0)) <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(0) = point(0) - <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>;
<a name="l00110"></a>00110 
<a name="l00111"></a>00111                                 <span class="keywordflow">if</span>(point(1) &gt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(1)) <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(1) = point(1) + <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>;
<a name="l00112"></a>00112                                 <span class="keywordflow">if</span>(point(1) &lt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(1)) <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(1) = point(1) - <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>;
<a name="l00113"></a>00113 
<a name="l00114"></a>00114                                 <span class="keywordflow">if</span>(point(2) &gt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(2)) <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(2) = point(2) + <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>;
<a name="l00115"></a>00115                                 <span class="keywordflow">if</span>(point(2) &lt; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(2)) <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(2) = point(2) - <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>;
<a name="l00116"></a>00116                         }
<a name="l00117"></a>00117                         <span class="keywordflow">else</span>
<a name="l00118"></a>00118                         {
<a name="l00119"></a>00119                                 <a class="code" href="class_vtl_1_1_a_a_b_box.html#ac460935fa714eda53b4f56ccaaf0cfa1" title="Resets the bounding box. Sets the bounding box to empty (uninitialized) state.">Reset</a>(point);
<a name="l00120"></a>00120                         }
<a name="l00121"></a>00121                 }
<a name="l00122"></a>00122 
<a name="l00128"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#aaf59e5cda1d26515a827855baa338f9c">00128</a>                 <span class="keywordtype">bool</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#aaf59e5cda1d26515a827855baa338f9c" title="Checks if the given point is inside the bounding box.">Contains</a>(<span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a489359c5f60cb9fd899f1dbb597a95c1">VectorType</a> &amp;_Point)<span class="keyword"> const</span>
<a name="l00129"></a>00129 <span class="keyword">                </span>{
<a name="l00130"></a>00130                         <span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> point = <a class="code" href="namespace_vtl_1_1common.html#a098b2df81e6cc14cbf9697452e836f93" title="Converts the given vector to 3D using the given K value for [i,j, K].">common::convertTo3D</a>(_Point);
<a name="l00131"></a>00131                         <span class="keywordflow">return</span> (point(0) &gt;= <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(0) &amp;&amp; point(0) &lt;= <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(0) &amp;&amp;
<a name="l00132"></a>00132                                 point(1) &gt;= <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(1) &amp;&amp; point(1) &lt;= <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(1) &amp;&amp;
<a name="l00133"></a>00133                                 point(2) &gt;= <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(2) &amp;&amp; point(2) &lt;= <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(2));
<a name="l00134"></a>00134                 }
<a name="l00135"></a>00135 
<a name="l00141"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#ab1cae69a8f46badabea1fe72afdc1633">00141</a>                 <span class="keywordtype">bool</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#ab1cae69a8f46badabea1fe72afdc1633" title="Checks if the given bounding box intersects.">IntersectWithBox</a>(<span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html">AABBox</a> &amp;_Box)<span class="keyword"> const</span>
<a name="l00142"></a>00142 <span class="keyword">                </span>{
<a name="l00143"></a>00143                         <span class="keywordflow">return</span> (<a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(0) &lt;= _Box.<a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(0) &amp;&amp; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(1) &lt;= _Box.<a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(1) &amp;&amp; <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(2) &lt;= _Box.<a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(2) &amp;&amp;
<a name="l00144"></a>00144                                 <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(0) &gt;= _Box.<a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(0) &amp;&amp; <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(1) &gt;= _Box.<a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(1) &amp;&amp; <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>(2) &gt;= _Box.<a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>(2));
<a name="l00145"></a>00145                 }
<a name="l00146"></a>00146 
<a name="l00152"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a7aa4a2614ce1a23acc4127d13fba79c8">00152</a>                 <span class="keywordtype">bool</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7aa4a2614ce1a23acc4127d13fba79c8" title="Checks if the given line intersects.">IntersectWithLine</a>(<span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a44276fff6cf9f37d7cd537dbdba3880b">ParametrizedLine</a> &amp;_Line)<span class="keyword"> const</span>
<a name="l00153"></a>00153 <span class="keyword">                </span>{
<a name="l00154"></a>00154                         <span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a85d1c3d9b76546addd7f711aeb0c024e">ParametrizedLineX3d</a> line = <a class="code" href="namespace_vtl_1_1common.html#a098b2df81e6cc14cbf9697452e836f93" title="Converts the given vector to 3D using the given K value for [i,j, K].">common::convertTo3D</a>(_Line);
<a name="l00155"></a>00155                         <span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> linevect = line.direction().normalized();
<a name="l00156"></a>00156                         <span class="keyword">const</span> Scalar halflength = line.direction().norm() * Scalar(0.5);
<a name="l00157"></a>00157                         <span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> e = <a class="code" href="class_vtl_1_1_a_a_b_box.html#a77476077b13c218952a2703735b0b179" title="Returns vector between the maximum and minimum edge.">getExtent</a>() * Scalar(0.5);
<a name="l00158"></a>00158                         <span class="keyword">const</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> t = <a class="code" href="class_vtl_1_1_a_a_b_box.html#a2afaaf9e1723b14bf2f2aa8af9840254" title="Returns the center point of the bounding box.">getCenter</a>() - (line.origin() + (line.direction() * Scalar(0.5)));
<a name="l00159"></a>00159 
<a name="l00160"></a>00160                         <span class="keywordflow">if</span> ((fabsl(t(0)) &gt; e(0) + halflength * fabsl(linevect(0))) ||
<a name="l00161"></a>00161                                 (fabsl(t(1)) &gt; e(1) + halflength * fabsl(linevect(1))) ||
<a name="l00162"></a>00162                                 (fabsl(t(2)) &gt; e(2) + halflength * fabsl(linevect(2))) )
<a name="l00163"></a>00163                                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00164"></a>00164 
<a name="l00165"></a>00165                         Scalar r = e(1) * Scalar(fabsl(linevect(2))) + e(2) * Scalar(fabsl(linevect(1)));
<a name="l00166"></a>00166                         <span class="keywordflow">if</span> (fabsl(t(1)*linevect(2) - t(2)*linevect(1)) &gt; r )
<a name="l00167"></a>00167                                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00168"></a>00168 
<a name="l00169"></a>00169                         r = e(0) * Scalar(fabsl(linevect(2))) + e(2) * Scalar(fabsl(linevect(0)));
<a name="l00170"></a>00170                         <span class="keywordflow">if</span> (fabsl(t(2)*linevect(0) - t(0)*linevect(2)) &gt; r )
<a name="l00171"></a>00171                                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00172"></a>00172 
<a name="l00173"></a>00173                         r = e(0) * Scalar(fabsl(linevect(1))) + e(1) * Scalar(fabsl(linevect(0)));
<a name="l00174"></a>00174                         <span class="keywordflow">if</span> (fabsl(t(0)*linevect(1) - t(1)*linevect(0)) &gt; r)
<a name="l00175"></a>00175                                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00176"></a>00176 
<a name="l00177"></a>00177                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00178"></a>00178                 }
<a name="l00179"></a>00179 
<a name="l00180"></a>00180         <span class="keyword">protected</span>:
<a name="l00181"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">00181</a>                 <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5e371769787d062c147d6bec7adefc3f">min</a>;
<a name="l00182"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">00182</a>                 <a class="code" href="class_vtl_1_1_a_a_b_box.html#a7e5298f3d3976f6b799ac3ec036164a8">VectorX3d</a> <a class="code" href="class_vtl_1_1_a_a_b_box.html#aa6340d1f0996be6aa66665cf4a1c9bda">max</a>;
<a name="l00183"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a3ed76b654dddf20fd2b3777afecdffbc">00183</a>                 <span class="keywordtype">bool</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a3ed76b654dddf20fd2b3777afecdffbc">is_empty</a>;
<a name="l00184"></a><a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">00184</a>                 <span class="keywordtype">double</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html#a5899b9e42f6dc952cb590ed7a7a34b75">eps</a>;
<a name="l00185"></a>00185         };
<a name="l00186"></a>00186 
<a name="l00187"></a><a class="code" href="namespace_vtl.html#a261e2f52bb4369b0dc9d314f2ad81f2d">00187</a>         <span class="keyword">typedef</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html">AABBox&lt;double, 3&gt;</a> <a class="code" href="namespace_vtl.html#a261e2f52bb4369b0dc9d314f2ad81f2d">AABBox3d</a>;
<a name="l00188"></a><a class="code" href="namespace_vtl.html#ae25f175acd1305203f7c24ee78b56eb5">00188</a>         <span class="keyword">typedef</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html">AABBox&lt;double, 2&gt;</a> <a class="code" href="namespace_vtl.html#ae25f175acd1305203f7c24ee78b56eb5">AABBox2d</a>;
<a name="l00189"></a><a class="code" href="namespace_vtl.html#a098d4c5a871a28d5c8f6d04884e04560">00189</a>         <span class="keyword">typedef</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html">AABBox&lt;float, 3&gt;</a> <a class="code" href="namespace_vtl.html#a098d4c5a871a28d5c8f6d04884e04560">AABBox3f</a>;
<a name="l00190"></a><a class="code" href="namespace_vtl.html#ae7a58f72f6ed94ea6c7d793cdc001393">00190</a>         <span class="keyword">typedef</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html">AABBox&lt;float, 2&gt;</a> <a class="code" href="namespace_vtl.html#ae7a58f72f6ed94ea6c7d793cdc001393">AABBox2f</a>;
<a name="l00191"></a><a class="code" href="namespace_vtl.html#a539faa2f057eb3db6ac2ba34254c951a">00191</a>         <span class="keyword">typedef</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html">AABBox&lt;int, 3&gt;</a> <a class="code" href="namespace_vtl.html#a539faa2f057eb3db6ac2ba34254c951a">AABBox3i</a>;
<a name="l00192"></a><a class="code" href="namespace_vtl.html#a57dbdafdc19a8bef76752bb79f064943">00192</a>         <span class="keyword">typedef</span> <a class="code" href="class_vtl_1_1_a_a_b_box.html">AABBox&lt;int, 2&gt;</a> <a class="code" href="namespace_vtl.html#a57dbdafdc19a8bef76752bb79f064943">AABBox2i</a>;
<a name="l00193"></a>00193 };
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_a_a_b_box_8h.html">AABBox.h</a>      </li>

    <li class="footer">Generated on Sun Apr 22 2012 14:58:32 for Vector Template Library (Vtl) by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.0 </li>
   </ul>
 </div>


</body>
</html>
